package rladidxo.basic;

import java.util.Scanner;

public class J05_CalrendarV1 {
public static void main(String[] args) {
	
	int[] months = new int[]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};    
	String[] days = new String[]{"일", "월", "화", "수", "목", "금", "토"};    
	Scanner sc = new Scanner(System.in);     
	int year;
	int month;       
	int day;        
	int total_day = 0;   
	System.out.print("연월일을 입력하시오 (입력형식 yyyy-mm-dd): ");       
	String[] date = sc.nextLine().split("-"); 
	sc.close();
	if (date.length != 3) {          
		System.out.println("연월일을 양식에 맞춰 다시 입력해 주시기 바랍니다.");          
		System.exit(1);       
		}       
	year = Integer.parseInt(date[0]);       
	month = Integer.parseInt(date[1]);      
	day = Integer.parseInt(date[2]);       
	total_day += (year-1900) * 365;        
	total_day += (year-1900)/4;        
	if(0 ==(year % 4) && 0 !=(year % 100) || 0 == (year % 400)) 
	{           
		if( month == 1 || month == 2) 
		{              
			total_day -= 1;  
			
			}        
		}        
	for(int i=0 ; i<month-1 ; i++) 
	{           
		total_day += months[i];  
		
		}        
	total_day += day;        
	System.out.println(year+"년 "+month+"월 "+day+"일은 "+days[total_day%7]+"요일입니다."); 
}
	
	

}

